Array.prototype.myMap = function(fn) {
  const res = [];
  this.reduce((prev,cur) => {
    res.push(fn(cur));
  }, this[0])
  return res;
}

const arr = [1, 2, 3, 4];
console.log(arr.myMap((item) => item * 2));
